<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>本地上传</title>
    <script src="./js/LiteJS/Lite.js" type="text/javascript"></script>
</head>

<body>

<div class="mui-content" id="content">
    <form id="upload_form" class="mui-input-group" method="post" enctype="multipart/form-data"
          action="/jlitetest/storage/upload.yx">
        <div class="mui-input-row">
            <label>选择文件</label>
            <input type="file" name="_file" id="_file">
        </div>
        <div class="mui-input-row">
            <label>自定文件名</label>
            <input type="text" name="fileName" class="mui-input-clear file_name" placeholder="请输入文件名">
        </div>
        <div class="mui-input-row">
            <label>资源类型</label>
            <input type="text" name="fileType" class="mui-input-clear file_name" placeholder="请输入资源类型">
        </div>
        <div class="mui-input-row">
            <label>资源备注</label>
            <input type="text" name="remark" class="mui-input-clear file_name" placeholder="请输入资源备注">
        </div>
        <div class="mui-button-row">
            <button id="confirm" type="submit" class="mui-btn mui-btn-primary">确认上传</button>
        </div>
    </form>
</div>

<script src="./js/common.js" type="text/javascript"></script>

<script type="text/javascript">

    function bindUploadFile() {
        // document.querySelector("#confirm").addEventListener("click", function (evt) {
        //     // var formData = new FormData();
        //     var _file = document.querySelector('#_file').files[0];
        //     if(!_file){
        //         return mui.alert("不能上传空文件");
        //     }
        //     // formData.append('_file', _file);
        //     var formData = new FormData(document.querySelector('#upload_form'));
        //     $http({
        //         method: "post",
        //         url: "./storage/upload.yx",
        //         data: formData,
        //         contentType: false,
        //         processData: false,
        //         success: function (data) {
        //             console.info(data);
        //         },
        //         Error:function (msg) {
        //             console.error(msg);
        //         }
        //     });
        // });
    }

    function _callback() {
        mui.init();

        mui.ready(function () {
            //加载模板数据
        });

        // bindUploadFile();
    }

</script>

</body>

</html>